#include "stdafx.h"
#include "TestCone.h"
#include "UECone.h"
#include "UEEntityOperation.h"


CPPUNIT_TEST_SUITE_REGISTRATION( TestCone );


TestCone::TestCone()
{
}


TestCone::~TestCone()
{
}

void TestCone::testCreate()
{
	double dRBottom;
	double dRTop;
	double dHeight;
	AcGePoint3d BasePoint;
	AcGeVector3d HeightDir;

	dRBottom = 300;
	dRTop = 100;
	dHeight = 300;
	BasePoint.set( 100, 0, 100 );
	HeightDir.set( 1, 1, 1 );

	CUECone Cone( BasePoint, HeightDir, dRBottom,
				dRTop, dHeight );
	
	AcDb3dSolid* pSolid = NULL;

    pSolid = Cone.Create();
	
	Acad::ErrorStatus es = CUEEntityOperation::AddEntityToDwg( pSolid );
	
	if ( es != Acad::eOk )
	{
	    delete pSolid;
	}
	
	pSolid->close();
}

void TestCone::testErrorCreate()
{
	double dRBottom;
	double dRTop;
	double dHeight;
	AcGePoint3d BasePoint;
	AcGeVector3d HeightDir;

	dRBottom = 0;
	dRTop = 300;
	dHeight = 300;
	BasePoint = AcGePoint3d::kOrigin;
	HeightDir = AcGeVector3d::kZAxis;

	CUECone Cone( BasePoint, HeightDir, dRBottom,
				dRTop, dHeight );
	
	AcDb3dSolid* pSolid = NULL;

	try
	{
	    pSolid = Cone.Create();
	}
	catch ( CString& strError )
	{
	    CPPUNIT_NS::Asserter::fail( (LPCTSTR)strError );
	}
	
	Acad::ErrorStatus es = CUEEntityOperation::AddEntityToDwg( pSolid );
	
	if ( es != Acad::eOk )
	{
	    delete pSolid;
	}
	
	pSolid->close();
}
